kit
is a minimal, educational version control system written in modern C++. Inspired by Git, it is designed to help developers learn and explore the internals of version control systems.
-
kit init
β Initialize a repository. -
kit add <file>
β Stage files. -
kit commit
β Commit staged files. -
kit log
β Show commit history. -
kit status
β Show repository status. -
.kit
structure and object storage. -
kit stash
β Temporarily save changes. -
kit branch
β Manage branches. -
kit checkout
β Switch branches. -
kit merge
β Merge branches. -
kit reset
β Reset to a specific commit. -
kit diff
β Show differences between commits or the working directory.
Follow these steps to set up and use kit-vcs
:
-
Clone the repository:
git clone https://github.com/yourusername/kit-vcs.git cd kit-vcs
-
Build the project:
mkdir build && cd build cmake .. make
-
Run the CLI:
./kit-vcs --help
Here are the Git-like commands supported by kit-vcs
:
kit init
β Initialize a new repository.kit add <file>
β Add file(s) to the staging area.kit commit -m <message>
β Commit staged files with a message.kit log
β Show commit history.kit status
β Show the current status of the repository.kit stash
β Stash changes temporarily.kit branch
β Manage branches.kit checkout <branch>
β Switch to a specific branch.kit merge <branch>
β Merge a branch into the current branch.kit reset <commit>
β Reset to a specific commit.kit diff
β Show differences between commits or the working directory.
Hereβs an example of how to use kit-vcs
:
kit init
kit add main.cpp
kit commit -m "Initial commit"
kit log
The .kit
directory structure:
.kit/
βββ HEAD # Points to the current branch or commit
βββ objects/ # Stores file snapshots and commits
βββ refs/ # Stores references to branches
β βββ heads/ # Stores branch heads
βββ stash/ # Stores stashed changes
- C++17 β Modern C++ for clean and efficient code.
- CMake β Build system for cross-platform compatibility.
- cxxopts β Lightweight CLI parser.
- Filesystem API β For file and directory operations.
- (Future) OpenSSL or Crypto++ β For hashing and encryption.
- Learn Git internals.
- Write a clean version control system.
- Play with low-level file I/O, hashing, and DAGs.
- Create, list, and delete branches.
- Store branch references in
.kit/refs/heads
.
- Switch between branches or specific commits.
- Update the working directory to match the target branch or commit.
- Merge changes from one branch into another.
- Handle conflicts during the merge process.
- Reset the repository to a specific commit.
- Support soft, mixed, and hard resets.
- Show differences between:
- The working directory and the last commit.
- Two specific commits.
- Highlight added, modified, and deleted lines.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests to improve kit-vcs
.